﻿using InventoryIssue.API.Read.Application.Command.Reportloss;
using InventoryIssue.Dtos;
using InventoryIssue.ErrorCode;
using InventoryIssue.Infrastructrue.Implement;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace InventoryIssue.API.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ReportlossController : ControllerBase
    {
        private readonly IMediator mediator;

        public ReportlossController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 查询报损信息接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<ReportlossDto>> GetReportloss([FromQuery]GetReportlossCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 查询报损产品信息接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<ReportlossProductDto>>> GetReportlossProduct([FromQuery] GetReportlossProductCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }
    }
}
